<template>
  <div class="applicationarea">
    <!-- 默认应用列表 -->
    <section v-if="!datas.imageList || !datas.imageList[0]" class="defaultNavigation">
      <span>{{ datas.title }}</span>
      <!-- 应用 -->
      <div class="navigationList">
        <div class="navlist">
          <div class="daohanglist" v-for="index in 4" :key="index">
            <!-- 图片 -->
            <img
              src="../../../assets/images/imgs.png"
              alt="默认图片"
              draggable="false"
              :style="{ 'border-radius': datas.borderRadius + '%' }"
            />
            <!-- 文字 -->
            <p :style="{ color: datas.textColor, 'font-size': datas.textSize + 'px' }">应用名称</p>
          </div>
        </div>
      </div>
    </section>

    <!-- 应用列表 -->
    <section v-else class="defaultNavigation">
      <!-- 应用 -->
      <div class="navigationList">
        <div v-for="(item, index) in datas.imageList" :key="index">
          <span>{{ item.sectionName }}</span>
          <div class="navlist">
            <div class="daohanglist" v-for="(it, ind) in item.application" :key="ind">
              <!-- 图片 -->
              <img :src="it.src" draggable="false" :style="{ 'border-radius': datas.borderRadius + '%' }" />
              <!-- 文字 -->
              <p :style="{ color: datas.textColor, 'font-size': datas.textSize + 'px' }"> {{ it.text }} </p>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 删除组件 -->
    <slot name="deles" />
  </div>
</template>
<script>
export default {
  name: "Applicationarea",
  props: {
    datas: Object,
  },
  created() {
    console.log(this.datas, "--------applicationarea");
  },
};
</script>
<style lang="scss" scope>
.applicationarea {
  position: relative;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  /* 默认导航 */
  .defaultNavigation {
    background: #fff;
    margin: 10px 14px;
    border-radius: 8px;
    span {
      font-size: 18px;
      padding: 10px 0 10px 10px;
      display: block;
      font-weight: bold;
    }
    /* 导航 */
    .navigationList {
      .navlist {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        .daohanglist {
          width: 25%;
          text-align: center;
          img {
            margin-top: 5px;
            width: 45px;
            height: 45px;
          }
          p {
            font-size: 12px;
            margin-top: 5px;
            width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            text-align: center;
            box-sizing: border-box;
          }
        }
      }
    }
  }
}
</style>
